package fr.iut.tp3.view.components;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ScrollPaneConstants;
import javax.swing.table.TableColumn;

import fr.iut.tp3.Context;
import fr.iut.tp3.model.ListeUtilisateursImpl.Colonne;

public class CouleurTableUtilisateurs extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3963612509033278218L;

	public CouleurTableUtilisateurs(Context context) {
		this.setLayout(new BorderLayout());
		JTable table = new JTable(context.getListeUtilisateurs());
		JScrollPane scrollPane  = new JScrollPane(table,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		this.add(scrollPane,BorderLayout.CENTER);
		TableColumn dureeColumn = table.getColumn(Colonne.NIV_PRIVILEGE
				.getLabel());
		PrivilegeCellRenderer dr = new PrivilegeCellRenderer();
		dureeColumn.setCellRenderer(dr);
		table.setRowHeight(30);
	}

}
